//
//  BiDismountIndexViewController.m
//  TrunkIndustryManageSystem
//
//  Created by WT_lyy on 15/4/27.
//  Copyright (c) 2015年 李璐西. All rights reserved.
//

#import "BiDismountIndexViewController.h"
#import "BiDismountListViewController.h"
@interface BiDismountIndexViewController ()

@end

@implementation BiDismountIndexViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSDictionary * imageDic = [NSDictionary dictionaryWithObjectsAndKeys:@"common/icon_liebiao",@"disassemblycheck",
                               @"common/icon_liebiao",@"disassemblyendcheck",nil];
    
    
    NSDictionary * titleDic = [NSDictionary dictionaryWithObjectsAndKeys:@"拆装审批",@"disassemblycheck",
                               @"拆装完结审批",@"disassemblyendcheck",nil];
    
    
    
    NSMutableArray * imagearr = [NSMutableArray array];
    NSMutableArray * titlearr = [NSMutableArray array];
    NSArray * saleArr = [BiUserEntity sharedInstance].permissionDic[@"zhengchechaizhuang"];
    
    for (int i =0 ; i < saleArr.count; i++) {
        NSString * dismountStr = saleArr[i];
        
        [imagearr addObject:imageDic[dismountStr]];
        
        [titlearr addObject:titleDic[dismountStr]];
    }
    

    [self refreshTable:titlearr imageArr:titlearr title:@"整车拆装"];
    
    self.view.backgroundColor = UIColorFromRGB(0xfafbfc);
}

#pragma -mark UitabeViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    UITableViewCell * cell  = [tableView cellForRowAtIndexPath:indexPath];
    
    UILabel * tltlelab = (UILabel *)[cell viewWithTag:2];
    
    BiDismountListViewController  * viewCtrl = [[BiDismountListViewController alloc] init];
    
    if (tltlelab.text.hash == @"拆装审批".hash) {
        
        viewCtrl.type = 1;
    }

    else  if (tltlelab.text.hash == @"拆装完结审批".hash) {
        
        viewCtrl.type = 2;
    }
    
    [self.navigationController pushViewController:viewCtrl animated:YES];
    
}

@end